import _ from 'lodash';

const data = [
  {
    title: 'steps.starter.title',
    description: 'steps.starter.description',
    content: 'Understand? OK or NOT',
    initialFlags: 'g',
    flags: 'g',
    regex: ['OK'],
    answer: ['OK'],
  },
  {
    title: 'steps.whatIsRegex.title',
    description: 'steps.whatIsRegex.description',
    originalTitle: 'Regular Expressions',
    content: 'readme.md\ndocument.pdf\nimage.png\nmusic.mp4\nmanual.pdf',
    initialFlags: 'gm',
    flags: 'gm',
    regex: ['^\\w+\\.pdf$'],
    initialValue: '^\\w+\\.pdf$',
    readOnly: true,
    answer: ['document.pdf', 'manual.pdf'],
  },
  {
    title: 'steps.basicMatchers.title',
    description: 'steps.basicMatchers.description',
    originalTitle: 'Basic Matchers',
    content: '“I have no special talents. I am only passionately curious.”\n\n― Albert Einstein',
    initialFlags: 'gm',
    flags: 'gm',
    regex: ['curious'],
    initialValue: '',
    answer: ['curious'],
  },
  {
    title: 'steps.dotCharacter.title',
    description: 'steps.dotCharacter.description',
    originalTitle: 'The Full Stop',
    content: 'abcABC123 .:!?',
    initialFlags: 'g',
    flags: 'g',
    regex: ['.'],
    answer: 'abcABC123 .:!?'.split(''),
  },
  {
    title: 'steps.characterSet.title',
    description: 'steps.characterSet.description',
    originalTitle: 'Character Sets',
    content: 'bar ber bir bor bur',
    initialValue: 'b[]r',
    initialFlags: 'g',
    flags: 'g',
    regex: ['b[aeiou]r'],
    customValidate: regex => {
      const $regex = new RegExp(`^b\\[([aeiou]{5})\\]r$`);
      const result = regex.match($regex) || [];
      return _.isEmpty(_.xor(result?.[0]?.split(''), 'aeiou'.split('')));
    },
    cursorPosition: 2,
    answer: ['bar', 'ber', 'bir', 'bor', 'bur'],
  },
  {
    title: 'steps.negatedCharacterSet.title',
    description: 'steps.negatedCharacterSet.description',
    originalTitle: 'Negated Character Sets',
    content: 'bar ber bir bor bur',
    initialValue: 'b[^]r',
    initialFlags: 'g',
    flags: 'g',
    regex: ['b[^eo]r', 'b[^oe]r'],
    cursorPosition: 3,
    answer: ['bar', 'bir', 'bur'],
  },
  {
    title: 'steps.range.title',
    originalTitle: 'Character Sets: Alphanumeric Range',
    description: 'steps.range.description',
    content: 'abcdefghijklmnopqrstuvwxyz',
    initialValue: '[-]',
    initialFlags: 'g',
    flags: 'g',
    regex: ['[e-o]'],
    cursorPosition: 1,
    answer: ['e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o'],
  },
  {
    title: 'steps.rangeNumber.title',
    description: 'steps.rangeNumber.description',
    originalTitle: 'Character Sets: Digit Range',
    content: '0123456789',
    initialValue: '[-]',
    initialFlags: 'g',
    flags: 'g',
    regex: ['[3-6]'],
    cursorPosition: 1,
    answer: ['3', '4', '5', '6'],
  },
  {
    title: 'examples.starter.title',
    description: 'examples.starter.description',
    image: '/Practise Starter.webp',
    interactive: false,
  },
  {
    title: 'examples.basicMatchers.title',
    description: 'examples.basicMatchers.description',
    originalTitle: 'Basic Matchers',
    content:
      '“Every man takes the limits of his own field of vision for the limits of the world.”\n― Arthur Schopenhauer',
    initialFlags: 'g',
    flags: 'g',
    regex: ['of'],
    answer: ['of', 'of', 'of'],
  },
  {
    title: 'examples.dotCharacter.title',
    description: 'examples.dotCharacter.description',
    originalTitle: 'The Full Stop',
    content: 'az AZ 09 _- = !? ., :;',
    initialFlags: 'g',
    flags: 'g',
    regex: ['.'],
    answer: 'az AZ 09 _- = !? ., :;'.split(''),
  },
  {
    title: 'examples.characterSet.title',
    description: 'examples.characterSet.description',
    originalTitle: 'Character Sets',
    content: 'beer deer feer',
    initialFlags: 'g',
    flags: 'g',
    regex: ['[bdf]eer'],
    customValidate: regex => {
      const $regex = new RegExp(`^\\[([bdf]{3})\\]eer$`);
      const result = regex.match($regex);
      return _.isEmpty(_.xor(result?.[0]?.split(''), 'bdf'.split('')));
    },
    answer: ['beer', 'deer', 'feer'],
  },
  {
    title: 'examples.negatedCharacterSet.title',
    description: 'examples.negatedCharacterSet.description',
    originalTitle: 'Negated Character Sets',
    content: 'bear beor beer beur',
    initialFlags: 'g',
    flags: 'g',
    regex: ['be[^ou]r', 'be[^uo]r'],
    answer: ['bear', 'beer'],
  },
  {
    title: 'examples.range.title',
    description: 'examples.range.description',
    originalTitle: 'Character Sets: Alphanumeric Range',
    content: 'abcdefghijklmnopqrstuvwxyz',
    initialFlags: 'g',
    flags: 'g',
    regex: ['[g-k]'],
    answer: ['g', 'h', 'i', 'j', 'k'],
  },
  {
    title: 'examples.rangeNumber.title',
    description: 'examples.rangeNumber.description',
    originalTitle: 'Character Sets: Digit Range',
    content: '0123456789',
    initialFlags: 'g',
    flags: 'g',
    regex: ['[2-7]'],
    cursorPosition: 1,
    answer: ['2', '3', '4', '5', '6', '7'],
  },
  {
    title: 'examples.finish.title',
    description: 'examples.finish.description',
    image: '/Practise Starter.webp',
    interactive: false,
  },
  {
    title: 'steps.repetitions.title',
    description: 'steps.repetitions.description',
    originalTitle: 'Repetitions',
    interactive: false,
  },
  {
    title: 'steps.asterisk.title',
    description: 'steps.asterisk.description',
    originalTitle: 'Repetitions: Asterisk',
    content: 'br ber beer',
    initialValue: 'ber',
    initialFlags: 'g',
    flags: 'g',
    regex: ['be*r'],
    cursorPosition: 2,
    answer: ['br', 'ber', 'beer'],
  },
  {
    title: 'steps.plusCharacter.title',
    description: 'steps.plusCharacter.description',
    originalTitle: 'Repetitions: The Plus',
    content: 'br ber beer',
    initialValue: 'ber',
    initialFlags: 'g',
    flags: 'g',
    regex: ['be+r'],
    cursorPosition: 2,
    answer: ['ber', 'beer'],
  },
  {
    title: 'steps.questionMark.title',
    description: 'steps.questionMark.description',
    originalTitle: 'Repetitions: The Question Mark',
    content: 'color, colour',
    initialValue: 'colour',
    initialFlags: 'g',
    flags: 'g',
    regex: ['colou?r'],
    cursorPosition: 5,
    answer: ['color', 'colour'],
  },
  {
    title: 'steps.quantifier.title',
    description: 'steps.quantifier.description',
    originalTitle: 'Repetitions: Curly Braces',
    content: 'ber beer beeer beeeer',
    initialValue: 'be{}r',
    initialFlags: 'g',
    flags: 'g',
    regex: ['be{2}r'],
    cursorPosition: 3,
    answer: ['beer'],
  },
  {
    title: 'steps.quantifierMin.title',
    description: 'steps.quantifierMin.description',
    originalTitle: 'Repetitions: Curly Braces',
    content: 'ber beer beeer beeeer',
    initialValue: 'be{,}r',
    initialFlags: 'g',
    flags: 'g',
    regex: ['be{3,}r'],
    cursorPosition: 3,
    answer: ['beeer', 'beeeer'],
  },
  {
    title: 'steps.quantifierRange.title',
    description: 'steps.quantifierRange.description',
    originalTitle: 'Repetitions: Curly Braces',
    content: 'ber beer beeer beeeer',
    initialValue: 'be{,}r',
    initialFlags: 'g',
    flags: 'g',
    regex: ['be{1,3}r'],
    cursorPosition: 3,
    answer: ['ber', 'beer', 'beeer'],
  },
  {
    title: 'examples.starter.title',
    description: 'examples.starter.description',
    image: '/Practise Starter.webp',
    interactive: false,
  },
  {
    title: 'examples.asterisk.title',
    description: 'examples.asterisk.description',
    originalTitle: 'Repetitions: Asterisk',
    content: 'dp dep deep',
    initialValue: '',
    initialFlags: 'g',
    flags: 'g',
    regex: ['de*p'],
    answer: ['dp', 'dep', 'deep'],
  },
  {
    title: 'examples.plusCharacter.title',
    description: 'examples.plusCharacter.description',
    originalTitle: 'Repetitions: The Plus',
    content: 'dp dep deep',
    initialValue: '',
    initialFlags: 'g',
    flags: 'g',
    regex: ['de+p'],
    answer: ['dep', 'deep'],
  },
  {
    title: 'examples.questionMark.title',
    description: 'examples.questionMark.description',
    originalTitle: 'Repetitions: The Question Mark',
    content: 'a, an',
    initialValue: '',
    initialFlags: 'g',
    flags: 'g',
    regex: ['an?'],
    answer: ['a', 'an'],
  },
  {
    title: 'examples.quantifier.title',
    description: 'examples.quantifier.description',
    originalTitle: 'Repetitions: Curly Braces',
    content: 'Release 10/9/2021',
    initialValue: '',
    initialFlags: 'g',
    flags: 'g',
    regex: ['[0-9]{4}', '\\d{4}'],
    answer: ['2021'],
  },
  {
    title: 'examples.quantifierMin.title',
    description: 'examples.quantifierMin.description',
    originalTitle: 'Repetitions: Curly Braces',
    content: 'Release 10/9/2021',
    initialValue: '',
    initialFlags: 'g',
    flags: 'g',
    regex: ['[0-9]{2,}', '\\d{2,}'],
    answer: ['10', '2021'],
  },
  {
    title: 'examples.quantifierRange.title',
    description: 'examples.quantifierRange.description',
    originalTitle: 'Repetitions: Curly Braces',
    content: 'Release 10/9/2021',
    initialValue: '',
    initialFlags: 'g',
    flags: 'g',
    regex: ['[0-9]{1,4}', '\\d{1,4}'],
    answer: ['10', '9', '2021'],
  },
  {
    title: 'examples.finish.title',
    description: 'examples.finish.description',
    image: '/Practise Starter.webp',
    interactive: false,
  },
  {
    title: 'steps.groupping.title',
    description: 'steps.groupping.description',
    originalTitle: 'Groupping',
    content: 'ha-ha,haa-haa',
    initialValue: '(h)',
    initialFlags: 'g',
    flags: 'g',
    regex: ['(haa)'],
    cursorPosition: 2,
    answer: ['haa', 'haa'],
  },
  {
    title: 'steps.groupReference.title',
    description: 'steps.groupReference.description',
    originalTitle: 'Group Reference',
    content: 'ha-ha,haa-haa',
    initialValue: '(ha)-\\1,(haa)-',
    initialFlags: 'g',
    flags: 'g',
    regex: ['(ha)-\\1,(haa)-\\2'],
    cursorPosition: 14,
    answer: ['ha-ha,haa-haa'],
  },
  {
    title: 'steps.nonCapturingGroupping.title',
    description: 'steps.nonCapturingGroupping.description',
    originalTitle: 'Non-capturing Groupping',
    content: 'ha-ha,haa-haa',
    initialValue: '(?:ha)-ha,(haa)-',
    initialFlags: 'g',
    flags: 'g',
    regex: ['(?:ha)-ha,(haa)-\\1'],
    cursorPosition: 16,
    answer: ['ha-ha,haa-haa'],
  },
  {
    title: 'steps.pipeCharacter.title',
    description: 'steps.pipeCharacter.description',
    originalTitle: 'Alternation',
    content: 'cat Cat rat',
    initialValue: '(C|c)at',
    initialFlags: 'g',
    flags: 'g',
    regex: ['(C|c)at|rat'],
    cursorPosition: 7,
    answer: ['cat', 'Cat', 'rat'],
  },
  {
    title: 'steps.escapeCharacter.title',
    description: 'steps.escapeCharacter.description',
    originalTitle: 'Escape Character',
    content: '(*) Asteriks.',
    initialFlags: 'g',
    initialValue: '(*|.)',
    cursorPosition: 1,
    flags: 'g',
    regex: ['(\\*|\\.)'],
    answer: ['*', '.'],
  },
  {
    title: 'steps.caret.title',
    description: 'steps.caret.description',
    originalTitle: 'Start of The String',
    content: 'Basic Omellette Recipe\n\n1. 3 eggs, beaten\n2. 1 tsp sunflower oil\n3. 1 tsp butter',
    initialValue: '[0-9]',
    initialFlags: 'gm',
    flags: 'gm',
    regex: ['^[0-9]', '^\\d'],
    answer: ['1', '2', '3'],
  },
  {
    title: 'steps.dollar.title',
    description: 'steps.dollar.description',
    originalTitle: 'End of The String',
    content:
      'https://domain.com/what-is-html.html\nhttps://otherdomain.com/html-elements\nhttps://website.com/html5-features.html',
    initialValue: 'html',
    initialFlags: 'gm',
    flags: 'gm',
    regex: ['html$'],
    cursorPosition: 4,
    answer: ['html', 'html'],
  },
  {
    title: 'steps.wordCharacter.title',
    description: 'steps.wordCharacter.description',
    originalTitle: 'Alphanumeric',
    content: 'abcABC123 _.:!?',
    initialFlags: 'g',
    flags: 'g',
    regex: ['\\w', '[a-zA-Z0-9_]'],
    answer: ['a', 'b', 'c', 'A', 'B', 'C', '1', '2', '3', '_'],
  },
  {
    title: 'steps.withoutWordCharacter.title',
    description: 'steps.withoutWordCharacter.description',
    originalTitle: 'Non-alphanumeric',
    content: 'abcABC123 _.:!?',
    initialFlags: 'g',
    flags: 'g',
    regex: ['\\W', '[^a-zA-Z0-9_]'],
    answer: [' ', '.', ':', '!', '?'],
  },
  {
    title: 'steps.numberCharacter.title',
    description: 'steps.numberCharacter.description',
    originalTitle: 'Digits',
    content: 'abcABC123 .:!?',
    initialFlags: 'g',
    flags: 'g',
    regex: ['\\d', '[0-9]'],
    answer: ['1', '2', '3'],
  },
  {
    title: 'steps.withoutNumberCharacter.title',
    description: 'steps.withoutNumberCharacter.description',
    originalTitle: 'Non-digits',
    content: 'abcABC123 .:!?',
    initialFlags: 'g',
    flags: 'g',
    regex: ['\\D', '[^0-9]'],
    answer: ['a', 'b', 'c', 'A', 'B', 'C', ' ', '.', ':', '!', '?'],
  },
  {
    title: 'steps.spaceCharacter.title',
    description: 'steps.spaceCharacter.description',
    originalTitle: 'Whitespace Characters',
    content: 'abcABC123 .:!?',
    initialFlags: 'g',
    flags: 'g',
    regex: ['\\s'],
    answer: [' '],
  },
  {
    title: 'steps.withoutSpaceCharacter.title',
    description: 'steps.withoutSpaceCharacter.description',
    originalTitle: 'Non-whitespace Characters',
    content: 'abcABC123 .:!?',
    initialFlags: 'g',
    flags: 'g',
    regex: ['\\S'],
    answer: ['a', 'b', 'c', 'A', 'B', 'C', '1', '2', '3', '.', ':', '!', '?'],
  },
  {
    title: 'steps.lookarounds.title',
    description: 'steps.lookarounds.description',
    originalTitle: 'Lookarounds',
    interactive: false,
  },
  {
    title: 'steps.positiveLookahead.title',
    description: 'steps.positiveLookahead.description',
    originalTitle: 'Lookarounds: Positive Lookahead',
    content: 'Date: 4 Aug 3PM',
    initialFlags: 'g',
    flags: 'g',
    cursorPosition: 3,
    initialValue: '\\d+',
    regex: ['\\d+(?=PM)'],
    answer: ['3'],
  },
  {
    title: 'steps.negativeLookahead.title',
    description: 'steps.negativeLookahead.description',
    originalTitle: 'Lookarounds: Negative Lookahead',
    content: 'Date: 4 Aug 3PM',
    initialFlags: 'g',
    flags: 'g',
    cursorPosition: 3,
    initialValue: '\\d+',
    regex: ['\\d+(?!PM)'],
    answer: ['4'],
  },
  {
    title: 'steps.positiveLookbehind.title',
    description: 'steps.positiveLookbehind.description',
    originalTitle: 'Lookarounds: Positive Lookbehind',
    content: 'Product Code: 1064 Price: $5',
    initialFlags: 'g',
    flags: 'g',
    initialValue: '\\d+',
    regex: ['(?<=\\$)\\d+'],
    safariAccept: true,
    answer: ['5'],
  },
  {
    title: 'steps.negativeLookbehind.title',
    description: 'steps.negativeLookbehind.description',
    originalTitle: 'Lookarounds: Negative Lookbehind',
    content: 'Product Code: 1064 Price: $5',
    initialFlags: 'g',
    flags: 'g',
    initialValue: '\\d+',
    regex: ['(?<!\\$)\\d+'],
    safariAccept: true,
    answer: ['1064'],
  },
  {
    title: 'steps.flags.title',
    description: 'steps.flags.description',
    originalTitle: 'Flags',
    interactive: false,
  },
  {
    title: 'steps.flagsGlobal.title',
    description: 'steps.flagsGlobal.description',
    originalTitle: 'Flags: Global',
    content: 'domain.com, test.com, site.com',
    initialValue: '\\w+\\.com',
    flags: 'g',
    regex: ['\\w+\\.com'],
    cursorPosition: 8,
    answer: ['domain.com', 'test.com', 'site.com'],
    useFlagsControl: true,
  },
  {
    title: 'steps.flagsMultiline.title',
    description: 'steps.flagsMultiline.description',
    originalTitle: 'Flags: Multiline',
    content: 'domain.com\ntest.com\nsite.com',
    initialValue: '\\w+\\.com$',
    initialFlags: 'g',
    flags: 'gm',
    regex: ['\\w+\\.com$'],
    cursorPosition: 8,
    answer: ['domain.com', 'test.com', 'site.com'],
    useFlagsControl: true,
  },
  {
    title: 'steps.flagsCaseInsensitive.title',
    description: 'steps.flagsCaseInsensitive.description',
    originalTitle: 'Flags: Case Insensitive',
    content: 'DOMAIN.COM\nTEST.COM\nSITE.COM',
    initialValue: '\\w+\\.com$',
    initialFlags: 'gm',
    flags: 'gmi',
    regex: ['\\w+\\.com$'],
    cursorPosition: 8,
    answer: ['DOMAIN.COM', 'TEST.COM', 'SITE.COM'],
    useFlagsControl: true,
  },
  {
    title: 'steps.greedyMatching.title',
    description: 'steps.greedyMatching.description',
    originalTitle: 'Greedy Matching',
    content: 'ber beer beeer beeeer',
    initialValue: '.*r',
    regex: ['.*r'],
    initialFlags: '',
    flags: '',
    readOnly: true,
    cursorPosition: 1,
    answer: ['ber beer beeer beeeer', 'ber beer beeer beeeer'],
  },
  {
    title: 'steps.lazyMatching.title',
    description: 'steps.lazyMatching.description',
    originalTitle: 'Lazy Matching',
    content: 'ber beer beeer beeeer',
    initialValue: '.*r',
    regex: ['.*?r'],
    initialFlags: '',
    flags: '',
    cursorPosition: 2,
    answer: ['ber', 'ber'],
  },
  {
    title: 'steps.completeAllSteps.title',
    description: 'steps.completeAllSteps.description',
    image: '/Learn.webp',
    interactive: false,
  },
];

export default data;
